package com.qf.smsplatform.controller;
/*2021/10/31*/

import com.github.pagehelper.PageInfo;
import com.qf.smsplatform.dto.R;
import com.qf.smsplatform.pojo.TSearchParmas;
import com.qf.smsplatform.service.TSearchParmasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @YuTao
 */

@RestController
@RequestMapping("/search")
public class TSearchParmasController  {

    private TSearchParmasService tSearchParmasService;
    @Autowired
    public void settSearchParmasService(TSearchParmasService tSearchParmasService) {
        this.tSearchParmasService = tSearchParmasService;
    }

     @RequestMapping("/page")
      public R selectPage(int pageNum,int pageSize){
        PageInfo<TSearchParmas> pageInfo = tSearchParmasService.selectPage(pageNum, pageSize);
        return R.setOk(pageInfo);
      }

      @RequestMapping("/insert")
      public R insert(TSearchParmas tSearchParmas){
        tSearchParmasService.insertSearchParams(tSearchParmas);
        return R.setOk();
      }

    @RequestMapping("/update")
    public R update(TSearchParmas tSearchParmas){
        tSearchParmasService.updateSearchParams(tSearchParmas);
        return R.setOk();
    }

      @RequestMapping("/selectByType")
      public R selectByTypr(String type){
          TSearchParmas selectByType = tSearchParmasService.selectByType(type);
          return R.setOk(selectByType);
      }
      @RequestMapping("/delete")
      public R deleteById(int id){
        tSearchParmasService.deleteSearchParams(id);
        return R.setOk();
      }
}
